<script lang="ts"  setup>
import { reactive } from 'vue'
import { OPTIONS_CATEGOEY } from '@/utils/const.js'
import { codeToText } from 'element-china-area-data'
import router from '@/router/index.js'
import useApiStore from '@/store/api/index.js'
const apiStore = useApiStore()

//定义时间传递对象
const $emits = defineEmits(['searchParamsBtnEmits', 'resetParamsBtnEmits'])

// interface searchForm {
//   /** admin 或 editor */
//   username: string
//   /** 密码 */
//   password: string
//   /** 验证码 */
//   code: string
// }

const searchForm = reactive({
  result: '',
  sku: ''
})

const OPTIONS_TASK_TYPE = [{
  label: '全部',
  value: '',
},
{
  label: '正常',
  value: '0',
},
{
  label: '异常',
  value: '1',
}
]

//搜索用户信息参数传递
const searchBtn = () => {
  $emits('searchParamsBtnEmits', searchForm)
}
const goBack = () => {
  console.log('888',);
  router.back()
  // router.push('/main/search')
}
const resetBtn = () => {
  Object.assign(searchForm, {
    deptName: '',
    status: ''
  })
  $emits('resetParamsBtnEmits')
}
</script>

<template>
  <div class="search">
    <el-form :model="searchForm" >
      <el-row>
        <el-col :span="6" v-if="apiStore.taskStatus == '3'">
          <el-form-item label="审核结果" label-width="80px" >
          <el-select v-model="searchForm.result" >
            <el-option
              v-for="item in OPTIONS_TASK_TYPE"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            />
          </el-select>
        </el-form-item>
        </el-col>
        <el-col style="margin-left: 20px;"  :span="6" >
          <el-form-item label-width="100px" label="物资唯一码" >
            <el-input v-model="searchForm.sku"  />
          </el-form-item>
        </el-col>

        <el-button  style="margin-left: 20px;" type="primary" @click="searchBtn"  >
          <!-- <el-icon>
            <Search />
          </el-icon> -->
          <span>查询</span>
        </el-button>
        <el-button  style="margin-left: 20px;" type="primary" @click="goBack">
          <!-- <el-icon>
            <Search />
          </el-icon> -->
          <span>返回主任务</span>
        </el-button>
      </el-row>
    </el-form>
  </div>
</template>

<style scoped lang="less">
.search {
  //.el-form-item {
  //  font-weight: 700;
  //  padding: 0 30px 0 30px;
  // }

  margin-top: 20px;

  .el-col {
    margin-bottom: 20px;
  }

//  .el-button {
 //   width: 80px;
 // }
}
</style>
